package net.aiion.weave.impl.bytecode.events;

import net.aiion.weave.asm.Label;
import net.aiion.weave.spi.bytecode.BytecodeVisitor;
import net.aiion.weave.spi.bytecode.events.JumpInstructionBytecodeEvent;

public class JumpInstructionBytecodeEventImpl extends BytecodeEventImpl implements JumpInstructionBytecodeEvent
{
    private int opcode;
    private Label label;

    public JumpInstructionBytecodeEventImpl(final int aOpcode, final Label aLabel) {
        opcode = aOpcode;
        label = aLabel;
    }

    @Override
    public int getType() {
        return JUMP_INSTRUCTION;
    }

    @Override
    public void setOpcode(final int aOpcode) {
        opcode = aOpcode;
    }

    @Override
    public int getOpcode() {
        return opcode;
    }

    @Override
    public void setLabel(final Label aLabel) {
        label = aLabel;
    }

    @Override
    public Label getLabel() {
        return label;
    }

    @Override
    public BytecodeVisitor acceptBytecodeVisitor(final BytecodeVisitor aBytecodeVisitor) {
        aBytecodeVisitor.asBytecodeMethodVisitor().visitJumpInstruction(this);
        return aBytecodeVisitor;
    }
}
